QuickOPC User's Guide and Reference
GetConditionState(IEasyAEClient,String,String,String,String,Int64[]) Method
Example 



OpcLabs.EasyOpcClassic Assembly > OpcLabs.EasyOpc.AlarmsAndEvents Namespace > IEasyAEClientExtension Class > GetConditionState Method : GetConditionState(IEasyAEClient,String,String,String,String,Int64[]) Method
The client object that will perform the operation.
Name of the machine. Determines the computer on which the OPC server is located. May be an empty string, in which case the OPC server is assumed to exist on the local computer or at the computer specified for it by DCOM configuration.
Contains ProgID of the OPC server.
Fully qualified source name. A source name, as returned by browsing. The state of the condition instance associated with this source is returned.
A condition name, as returned by querying. The state of this condition is returned.
Specifies the event attributes to be returned.
Returns the current state information for the condition instance corresponding to the source and condition name. Returns the current state information for the condition instance corresponding to the source and condition name, passing in the individual parameters for server location and its class. Also allows to retrieve specified event attributes.
Syntax
'Declaration
 
<ExtensionAttribute()>
<NotNullAttribute()>
Public Overloads Shared Function GetConditionState( _
   ByVal client As IEasyAEClient, _
   ByVal machineName As String, _
   ByVal serverClass As String, _
   ByVal qualifiedSourceName As String, _
   ByVal conditionName As String, _
   ByVal attributes() As Long _
) As AEConditionState
'Usage
 
Dim client As IEasyAEClient
Dim machineName As String
Dim serverClass As String
Dim qualifiedSourceName As String
Dim conditionName As String
Dim attributes() As Long
Dim value As AEConditionState
 
value = IEasyAEClientExtension.GetConditionState(client, machineName, serverClass, qualifiedSourceName, conditionName, attributes)

Parameters

client
The client object that will perform the operation.
machineName
Name of the machine. Determines the computer on which the OPC server is located. May be an empty string, in which case the OPC server is assumed to exist on the local computer or at the computer specified for it by DCOM configuration.
serverClass
Contains ProgID of the OPC server.
qualifiedSourceName
Fully qualified source name. A source name, as returned by browsing. The state of the condition instance associated with this source is returned.
conditionName
A condition name, as returned by querying. The state of this condition is returned.
attributes
Specifies the event attributes to be returned.

Return Value

If successful, the function returns a AEConditionState object. The object contains information about the state of the condition.
Exceptions
ExceptionDescription
The OPC "Classic" (or OPC XML-DA) operation has failed.
The value of an argument is outside the allowable range of values as defined by the invoked method.
A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
Remarks

The server can be local or can be remotely accessed via DCOM. Optionally, an access path can be specified or a specific data type can be requested.

Some servers may not maintain sufficient condition state information to fully implement this method.

Example
// This example shows how to obtain current state information for the condition instance corresponding to a Source and 
// certain ConditionName.

using System;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.AlarmsAndEvents._EasyAEClient
{
    class GetConditionState 
    { 
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            AEConditionState conditionState;
            try
            {
                conditionState = client.GetConditionState("", "OPCLabs.KitEventServer.2",
                    "Simulation.ConditionState1", "Simulated");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            Console.WriteLine("ConditionState:");
            Console.WriteLine("    .ActiveSubcondition: {0}", conditionState.ActiveSubcondition);
            Console.WriteLine("    .Enabled: {0}", conditionState.Enabled);
            Console.WriteLine("    .Active: {0}", conditionState.Active);
            Console.WriteLine("    .Acknowledged: {0}", conditionState.Acknowledged);
            Console.WriteLine("    .Quality: {0}", conditionState.Quality);
            // Remark: IAEConditionState has many more properties
        }
    } 
}
' This example shows how to obtain current state information for the condition instance corresponding to a Source and 
' certain ConditionName.

Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.AlarmsAndEvents._EasyAEClient

    Friend Class GetConditionState
        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            Dim conditionState As AEConditionState
            Try
                conditionState = client.GetConditionState("", "OPCLabs.KitEventServer.2", "Simulation.ConditionState1", "Simulated")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            Console.WriteLine("ConditionState:")
            Console.WriteLine("    .ActiveSubcondition: {0}", conditionState.ActiveSubcondition)
            Console.WriteLine("    .Enabled: {0}", conditionState.Enabled)
            Console.WriteLine("    .Active: {0}", conditionState.Active)
            Console.WriteLine("    .Acknowledged: {0}", conditionState.Acknowledged)
            Console.WriteLine("    .Quality: {0}", conditionState.Quality)
            ' Remark: IAEConditionState has many more properties
        End Sub
    End Class

End Namespace
// This example shows how to obtain current state information for the condition instance corresponding to a Source and 
// certain ConditionName.

using System;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.AlarmsAndEvents._EasyAEClient
{
    class GetConditionState 
    { 
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            AEConditionState conditionState;
            try
            {
                conditionState = client.GetConditionState("", "OPCLabs.KitEventServer.2",
                    "Simulation.ConditionState1", "Simulated");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            Console.WriteLine("ConditionState:");
            Console.WriteLine("    .ActiveSubcondition: {0}", conditionState.ActiveSubcondition);
            Console.WriteLine("    .Enabled: {0}", conditionState.Enabled);
            Console.WriteLine("    .Active: {0}", conditionState.Active);
            Console.WriteLine("    .Acknowledged: {0}", conditionState.Acknowledged);
            Console.WriteLine("    .Quality: {0}", conditionState.Quality);
            // Remark: IAEConditionState has many more properties
        }
    } 
}
' This example shows how to obtain current state information for the condition instance corresponding to a Source and 
' certain ConditionName.

Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.AlarmsAndEvents._EasyAEClient

    Friend Class GetConditionState
        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            Dim conditionState As AEConditionState
            Try
                conditionState = client.GetConditionState("", "OPCLabs.KitEventServer.2", "Simulation.ConditionState1", "Simulated")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            Console.WriteLine("ConditionState:")
            Console.WriteLine("    .ActiveSubcondition: {0}", conditionState.ActiveSubcondition)
            Console.WriteLine("    .Enabled: {0}", conditionState.Enabled)
            Console.WriteLine("    .Active: {0}", conditionState.Active)
            Console.WriteLine("    .Acknowledged: {0}", conditionState.Acknowledged)
            Console.WriteLine("    .Quality: {0}", conditionState.Quality)
            ' Remark: IAEConditionState has many more properties
        End Sub
    End Class

End Namespace
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2012, Windows Server 2016; .NET Core, .NET 5, .NET 6: Linux, macOS, Microsoft Windows

See Also

Reference

IEasyAEClientExtension Class
IEasyAEClientExtension Members
Overload List